/**
 * post-table.js
 * 
 * Handles interactions on the table of posts
 */

$(document).ready(function(){
	
	$('table.post a.delete').removeClass('js-hidden').hide();
	$('table.post div.delete-confirm').removeClass('js-hidden').hide();
	
	$('table.post tr').hover(
		function (event) {
			
			$(this).find('a.delete').fadeIn(200);
		},
		function (event) {
			//$('table.post a.delete').addClass('js-hidden');
			$(this).find('a.delete').fadeOut(200);
		}
	);
	
	$('table.post a.delete').click(function (event){
		var matches = /.*\-([0-9]+)/.exec(this.id);
		var postId = matches[1];
		
		$('#delete-id-' + postId + '-confirm').toggle(200);
		$(this).toggleClass('delete-cancel');
		
	});
	
});

